/*
 * AbstractTheme.java  0.4.0 / Oct 25, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.styles;

/**
 * Abstract Theme.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public abstract class AbstractTheme extends Theme { // NOPMD - abstract class

// Private Fields. -------------------------------------------------------------

  private final String name;
  private final ColorPalette colorPalette;
  private final FontSet fontSet;
  private int hashCode; // NOPMD

// Protected Constructors. -----------------------------------------------------

  /**
   * Constructs new AbstractTheme object.
   *
   * @param colorPalette the color palette
   * @param fontSet the font set
   */
  protected AbstractTheme(ColorPalette colorPalette, FontSet fontSet) {
    this(null, colorPalette, fontSet);
  }

  /**
   * Constructs new AbstractTheme object.
   *
   * @param name the name
   * @param colorPalette the color palette
   * @param fontSet the font set
   */
  protected AbstractTheme(String name, ColorPalette colorPalette,
                          FontSet fontSet) {
    this.name = name;
    this.colorPalette = colorPalette;
    this.fontSet = fontSet;
  }

// Overridden Methods. ---------------------------------------------------------

  /**
   * {@inheritDoc}
   */
  public int hashCode() { // NOPMD
    if (hashCode == 0) {
      hashCode = super.hashCode();
    }
    return hashCode; // NOFB
  }

  /**
   * {@inheritDoc}
   */
  public String getName() {
    return name;
  }

  /**
   * {@inheritDoc}
   */
  public ColorPalette getColorPalette() {
    return colorPalette;
  }

  /**
   * {@inheritDoc}
   */
  public FontSet getFontSet() {
    return fontSet;
  }

}
